<?php
if (user()->id && user()->getModel()->status == User::STATUS_ACTIVE //
	&& user()->id != $model->user_id  //if user does not own this comment or post. 
	&& !$check //if user sent abuse
) {
    ?>
    <?php
    //if report abuse for post
    if ($model instanceof Posts) {
	?>
	<div class="in-line-tk">
	    <a title="Report abuse" class="show-form-post" href="#post_id_<?php echo $model->post_id; ?>"><i class="icon-flag"></i> Report</a>
	    <!-- Modal -->
	    <div id="post_id_<?php echo $model->post_id; ?>" class="abuse-box modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
		    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		    <h3 id="myModalLabel">Report abusing</h3>
		    for the post: "<?php echo $model->title; ?>"
		</div>
		<div class="modal-body">							
		    <select class="select-abusing">
			<?php foreach ($aStatementAbuse as $statementAbuse) { ?>
	    		<option value="<?php echo $statementAbuse['text'] ?>"><?php echo $statementAbuse['text'] ?></option>
			<?php } ?>
		    </select>							
		</div>
		<div class="modal-footer">
		    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
		    <a class="btn btn-primary send-abuse" 
		       user-id="<?php echo user()->id ?>" 
		       item-id="<?php echo $model->post_id ?>" 
		       type-id="<?php echo Abuse::POST_TYPE; ?>"
		       link="<?php echo SITE_NAME_URL ?>post/<?php echo $model->post_id ?>"
		       >Send</a>
		</div>
	    </div>
	</div>
	<?php
    } elseif ($model instanceof Comment) {
	//if report abuse for comment
	?>
	<div class="in-line-tk">
	    <a title="Report abuse" class="show-form-post" href="#comment_id_<?php echo $model->comment_id; ?>"><i class="icon-flag"></i> Report</a>
	    <!-- Modal -->
	    <div id="comment_id_<?php echo $model->comment_id; ?>" class="abuse-box modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
		    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		    <h3 id="myModalLabel">Report abusing</h3>
		    for the comment: "<?php echo h($model->content, 50); ?>"
		</div>
		<div class="modal-body">							
		    <select class="select-abusing">
			<?php foreach ($aStatementAbuse as $statementAbuse) { ?>
	    		<option value="<?php echo $statementAbuse['text'] ?>"><?php echo $statementAbuse['text'] ?></option>
			<?php } ?>
		    </select>							
		</div>
		<div class="modal-footer">
		    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
		    <a class="btn btn-primary send-abuse" 
		       user-id="<?php echo user()->id ?>" 
		       item-id="<?php echo $model->comment_id ?>" 
		       type-id="<?php echo Abuse::COMMENT_TYPE; ?>"
		       link="<?php echo SITE_NAME_URL ?>post/<?php echo $model->post_id ?>"
		       >Send</a>
		</div>
	    </div>
	</div>
	<?php
    }
}

    